export default {
  namespaced: true,
  state: {
    hospitalId: '163c1ce9dbb17d7sgf7s71dda80b8934e',
    personPhone: '',
    departmentId: '', // 科室id
    departmentName: '',
    doctorId: '', // 医生id
    // hasCheck: null // 是否已经通过验签 0 否 1 是
    hasCheck: 'false' // 是否已经通过验签 0 否 1 是
  },
  getters: {
    hospitalId: (state) => {
      return state.hospitalId || sessionStorage.getItem('hospitalId')
    },
    personPhone: (state) => {
      return state.personPhone || sessionStorage.getItem('personPhone')
    },
    departmentId: (state) => {
      return state.departmentId || sessionStorage.getItem('departmentId')
    },
    departmentName: (state) => {
      return state.departmentName || sessionStorage.getItem('departmentName')
    },
    doctorId: (state) => {
      return state.doctorId || sessionStorage.getItem('doctorId')
    },
    hasCheck: (state) => {
      return state.hasCheck || sessionStorage.getItem('hasCheck')
    }
  },
  mutations: {
    setHospitalId (state, id) {
      state.hospitalId = id
      sessionStorage.setItem('hospitalId', id)
    },
    setPersonPhone (state, phone) {
      state.personPhone = phone
      sessionStorage.setItem('personPhone', phone)
    },
    setDepartmentId (state, id) {
      state.departmentId = id
      sessionStorage.setItem('departmentId', id)
    },
    setDoctorId (state, id) {
      state.doctorId = id
      sessionStorage.setItem('doctorId', id)
    },
    setDepartmentName (state, name) {
      state.departmentName = name
      sessionStorage.setItem('departmentName', name)
    },
    setHasCheck (state, status) {
      state.departmentName = status
      sessionStorage.setItem('hasCheck', status)
    }
  }
}
